package lc.排序;

import java.util.Arrays;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/27
 */
public class 剑指Offer45_把数组排成最小的数 {

    public static String minNumber(int[] nums) {
        String[] s = new String[nums.length];
        StringBuilder str = new StringBuilder();
        for (int i = 0; i < nums.length; i++) {
            s[i] = String.valueOf(nums[i]);
        }
        Arrays.sort(s,(x,y) -> (x + y).compareTo(y + x));
        for (String s1 : s) {
            str.append(s1);
        }
        return str.toString();
    }

}
